<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShareDiamondLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('share_diamond_log', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('用户id');
            $table->integer('invite_uid')->comment('赠送邀请人id');
            $table->tinyInteger('d_rank')->default(1)->comment('默认赠送等级');
            $table->unsignedDecimal('recharge_money',10, 2)->comment('充值金额');
            $table->integer('recharge_diamond')->comment('充值钻石数量');
            $table->integer('award_diamond')->comment('奖励钻石数量');
            $table->timestamps();
            $table->index(['user_id','invite_uid']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('share_diamond_log');
    }
}
